Ban Or Unban Post
POST /admin/post/:postId
Description
Toggles a post's banned status.
Request Parameters
Requires Authentication: true
Requires Admin Role: true
PATH PARAMS
| Name | Type | Required | Description |
|---|---|---|---|
postId | string | Yes | MongoDB post ID. |
BODY
| Name | Type | Required | Description |
|---|---|---|---|
reason | string | No | Ban or unban reason. |
Success Response
{
"message": "johndoe's post from 2026-03-18T00:00:00.000Z banned successfully"
}
or
{
"message": "johndoe's post from 2026-03-18T00:00:00.000Z unbanned successfully"
}
Error Response
| Code | Description |
|---|---|
| 401 | Missing or invalid access token |
| 402 | User is not an admin |
| 404 | Post not found |
| 413 | Reason too long |
| 500 | Server error |